import { useMenuStore } from '@/store/menu';
import router from '@/router';
/**
 * @param {Array} value
 * @returns {Boolean}
 * @example see @/views/orderManage/redPacketMallOrderInfo.vue
 */
export default function checkPermission (value) {
  if (value && !Array.isArray(value)) {
    const permissionInfo = useMenuStore().permissionInfo;
    const permissionRoles = value;
    if (permissionInfo['w_' + router.currentRoute.value.name] === undefined) return false
    const hasPermission = permissionInfo['w_' + router.currentRoute.value.name].includes(permissionRoles);
    return hasPermission
  } else {
    console.error(`v-if="checkPermission('getOrderPrint')"`)
    return false
  }
}
